<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>群组管理</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/Public/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/Theme1/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/Theme1/css/animate.min.css" rel="stylesheet">
    <link href="/Public/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>群组管理
                        <small>
                            <a href="<?php echo U('/Admin/User/implodEdit');?>" style="margin-left: 15px; color: #06cbc4">添加群组</a>
                        </small>
                    </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>

                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>

                    <div class="ibox-content">
                        <form method="post" action="/index.php?s=/Admin/User/implode_index" class="form-horizontal"
                              enctype="multipart/form-data">
                            <div class="form-group">
                                <button id="btn" class="btn btn-success" type="submit">搜索</button>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control" value="<?php echo ($group_name); ?>" name="group_name"
                                           id="group_name" placeholder="请输入群组名">
                                </div>

                            </div>
                        </form>
                        <a href="/index.php?s=/Admin/User/uploadFlie" class="btn btn-danger" type="submit">下载模板文件</a>
                        <table class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>群组名</th>
                                <th>导入时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(is_array($result)): $i = 0; $__LIST__ = $result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$result): $mod = ($i % 2 );++$i;?><tr>
                                    <td><?php echo ($result["id"]); ?></td>
                                    <td><?php echo ($result["name"]); ?></td>
                                    <td><?php echo ($result["formart_time"]); ?></td>
                                    <td>
                                        <button class="btn btn-info" onclick="implode('<?php echo ($result['id']); ?>')">导入</button>
                                        <a href="/index.php?s=/Admin/User/implodEdit/id/<?php echo ($result['id']); ?>"><button class="btn btn-warning">修改</button></a>

                                        <a href="/index.php?s=/Admin/User/delGroup/id/<?php echo ($result['id']); ?>" onclick="if(confirm('是否只删除活动用户群(不会删除该用户群下用户)?')==false)return false;"><button class="btn btn-danger">删除</button></a>
                                        <!--<a title="删除" onclick="delOrder('<?php echo ($result["order_id"]); ?>')"-->
                                        <!--href="javascript:void(0);"><i-->
                                        <!--class="glyphicon glyphicon-remove"></i></a>-->
                                        <!--<a title="查看"-->
                                        <!--href="<?php echo U('Admin/Order/detail',array('order_id'=>$result['order_id']));?>"><i-->
                                        <!--class="glyphicon glyphicon-pencil" style="margin-right: 10px;"></i></a>-->

                                    </td>
                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>



                        <div class="pagination" style="margin:0px;">
                            <?php echo ($page); ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <script src="/Public/Theme1/js/jquery.min.js?v=2.1.4"></script>
    <script src="/Public/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/Public/Theme1/js/content.min.js?v=1.0.0"></script>
    <script src="/Public/Theme1/js/plugins/iCheck/icheck.min.js"></script>
    <script src="/Public/layer/layer.js"></script>

    <script>
        var aa = "<?php echo $phone ?>";
        if (aa != 0){
            layer.confirm(aa+"导入成功", {
                btn: ['确认'] //按钮
            }, function () {
                layer.msg('确认成功', {icon: 1});
            }, function () {
                layer.msg('取消成功', {});
            });
        }
        function implode(id) {
            layer.open({
                type: 1,
                content:'  <div class="ibox-content"><form method="post" action="/index.php?s=/Admin/User/implode" class="form-horizontal" enctype="multipart/form-data"><div class="form-group"> <label class="col-sm-2 control-label">导入文件</label> <div class="col-sm-6"> <input type="file" class="form-control" name="excel" id="excel" value="<?php echo ($result["excel"]); ?>" required> </div> </div> <div class="form-group"> <div class="col-sm-4 col-sm-offset-2"> <button class="btn btn-primary" type="submit">保存</button> </div> </div><input type="hidden" name="id" value="'+id+'"> </form> </div>',
                skin: 'layui-layer-rim',
                area: ['600px', '300px'],
                closeBtn: 1
            });
        }
        $(document).ready(function () {
            $(".i-checks").iCheck({checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green",})
        });

        function delOrder(order_id) {
            layer.alert('确定要删除吗?', {
                skin: 'layui-layer-molv' //样式类名  自定义样式
                , closeBtn: 1    // 是否显示关闭按钮
                , anim: 1 //动画类型
                , btn: ['确认', '取消'] //按钮
                , icon: 6    // icon
                , yes: function () {
                    window.location.href = "/index.php?s=/Admin/User/delOrder/id/" + order_id;
                }
                , btn2: function () {
                }
            });
        }
        function fahuo(order_id) {
            var lock = false; //默认未锁定
            layer.confirm('确定发货了？', {
                btn: ['确认', '取消'] //按钮
            }, function () {
                $.ajax({
                    url: "/index.php?s=/Admin/User/fahuo",
                    type: 'post',
                    dataType: 'json',
                    data: {'order_id': order_id},
                    success: function (data) {
                        if (data.state == 1) {
                            window.location.href = "/index.php?s=/Admin/User/index";
                        }
                    }
                });
                layer.msg('确认成功', {icon: 1});
            }, function () {
                layer.msg('取消成功', {});
            });
        }

    </script>
</body>
</html>